#ifndef __HDVB_CODES_H
#define __HDVB_CODES_H
/*
    libhdvbd - Library for building sophisticated DVB applications
    Copyright (C) 2012 Tony Houghton <h@realh.co.uk>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser general Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser general Public License for more details.

    You should have received a copy of the GNU Lesser general Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

/* Constants for stream type codes etc */

#include <glib.h>

G_BEGIN_DECLS

#define HDVB_TS_PACKET_SYNC_BYTE           0x47

#define HDVB_AUDIO_TYPE_UNDEFINED          0
#define HDVB_AUDIO_TYPE_CLEAR_EFFECTS      1
#define HDVB_AUDIO_TYPE_HEARING_IMPAIRED   2

#define HDVB_STREAM_TYPE_MPEG1_VIDEO       0x01
#define HDVB_STREAM_TYPE_MPEG2_VIDEO       0x02
#define HDVB_STREAM_TYPE_MPEG1_AUDIO       0x03
#define HDVB_STREAM_TYPE_MPEG2_AUDIO       0x04
#define HDVB_STREAM_TYPE_PRIVATE_TABLE     0x05
#define HDVB_STREAM_TYPE_PRIVATE_PES       0x06
#define HDVB_STREAM_TYPE_MHEG              0x07
#define HDVB_STREAM_TYPE_DSM_CC            0x08
#define HDVB_STREAM_TYPE_H222_1            0x09
#define HDVB_STREAM_TYPE_ISO_IEC_A         0x0A
#define HDVB_STREAM_TYPE_ISO_IEC_B         0x0B
#define HDVB_STREAM_TYPE_ISO_IEC_C         0x0C
#define HDVB_STREAM_TYPE_ISO_IEC_D         0x0D
#define HDVB_STREAM_TYPE_MP2_AUXILIARY     0x0E
#define HDVB_STREAM_TYPE_ADTS_AUDIO        0x0F
#define HDVB_STREAM_TYPE_MP4_VISUAL        0x10
#define HDVB_STREAM_TYPE_LATM_AUDIO        0x11
#define HDVB_STREAM_TYPE_H264_VIDEO        0x1B
#define HDVB_STREAM_TYPE_AC3_AUDIO         0x81

#define HDVB_STREAM_TYPE_IS_MPEG_VIDEO(t) ((t) == HDVB_STREAM_TYPE_MPEG1_VIDEO \
        || (t) == HDVB_STREAM_TYPE_MPEG2_VIDEO)

#define HDVB_STREAM_TYPE_IS_H264_VIDEO(t) ((t) == HDVB_STREAM_TYPE_H264_VIDEO)

#define HDVB_STREAM_TYPE_IS_VIDEO(t) \
        (HDVB_STREAM_TYPE_IS_MPEG_VIDEO(t) || HDVB_STREAM_TYPE_IS_H264_VIDEO(t))

#define HDVB_STREAM_TYPE_IS_MPEG_AUDIO(t) ((t) == HDVB_STREAM_TYPE_MPEG1_AUDIO \
        || (t) == HDVB_STREAM_TYPE_MPEG2_AUDIO)

#define HDVB_STREAM_TYPE_IS_AC3_AUDIO(t) ((t) == HDVB_STREAM_TYPE_AC3_AUDIO)

#define HDVB_STREAM_TYPE_IS_OTHER_AUDIO(t) ((t) == HDVB_STREAM_TYPE_ADTS_AUDIO \
        || (t) == HDVB_STREAM_TYPE_LATM_AUDIO)

#define HDVB_STREAM_TYPE_IS_AUDIO(t) (HDVB_STREAM_TYPE_IS_MPEG_AUDIO(t) || \
        HDVB_STREAM_TYPE_IS_AC3_AUDIO(t) || HDVB_STREAM_TYPE_IS_OTHER_AUDIO(t))


#define HDVB_SERVICE_TYPE_MPEG2_SDTV       0x01
#define HDVB_SERVICE_TYPE_MPEG2_RADIO      0x02
#define HDVB_SERVICE_TYPE_TELETEXT         0x03
#define HDVB_SERVICE_TYPE_ADVANCED_RADIO   0x0A
#define HDVB_SERVICE_TYPE_DATA             0x0C
#define HDVB_SERVICE_TYPE_MPEG2_HDTV       0x11
#define HDVB_SERVICE_TYPE_ADVANCED_SDTV    0x16
#define HDVB_SERVICE_TYPE_ADVANCED_HDTV    0x19

#define HDVB_RUNNING_STATUS_UNDEFINED      0
#define HDVB_RUNNING_STATUS_NOT_RUNNING    1
#define HDVB_RUNNING_STATUS_ABOUT_TO_START 2
#define HDVB_RUNNING_STATUS_PAUSED         3
#define HDVB_RUNNING_STATUS_RUNNING        4
#define HDVB_RUNNING_STATUS_OFF_AIR        5
        
#define HDVB_RUNNING_STATUS_MASK_NOT_RUNNING       (1<<1)
#define HDVB_RUNNING_STATUS_MASK_ABOUT_TO_START    (1<<2)
#define HDVB_RUNNING_STATUS_MASK_PAUSED            (1<<3)
#define HDVB_RUNNING_STATUS_MASK_RUNNING           (1<<4)
#define HDVB_RUNNING_STATUS_MASK_OFF_AIR           (1<<5)
        

G_END_DECLS

#endif /* __HDVB_CODES_H */
